home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
language
/
pcl_src.zoo
/
march-92-notes.txt
< prev
next >
Wrap
Text File
|
1992-04-19
|
14KB
|
312 lines
These notes correspond to the "March 92 PCL (beta1)" version of PCL.
This version of PCL is much closer than previous versions of PCL
to the metaobject protocol specified in "The Art of the Metaobject Protocol",
chapters 5 and 6, by Gregor Kiczales, Jim des Riveres, and Daniel G. Bobrow.
[Please read the file may-day-notes.text also. Most of that file still applies.]
Support for structures
You can use structure-class as a metaclass to create new classes.
Classes created this way create and evaluate defstruct forms which
have generated symbols for the structure accessors and constructor.
The generated symbols are used by the primary slot-value-using-class
methods and by the primary allocate-instance method for structures.
Defmethod optimizes usages of slot-value (when no user-defined
slot-value-using-class methods exist) into direct calls of the
generated symbol accessor, which the compiler can then optimize further.
Even when there are user-defined methods on slot-value-using-class,
PCL does a variety of optimizations.
If your implementation's version of the *-low.lisp file
contains definitions of certain structure functions (see the end of
low.lisp, cmu-low.lisp, lucid-low.lisp, and kcl-low.lisp), then
structure classes are supported for all defstructs. In this case,
structure classes are created automatically, when necessary.
New Classes:
structure-class
structure-object
slot-class
slot-object
structure-direct-slot-definition
structure-effective-slot-definition
Improvements to slot-access
Optimization for slot-value outsize of defmethod
Optimization for slot-value inside of defmethod, but not of a specialized parameter.
Optimizations that work even when there are :around methods
on slot-value-using-class.
New types:
`(class ,class-object)
`(class-eq ,class-object)
New specializer class: class-eq-specializer
Every class has a class-eq specializer which represents all
the direct instances of that class.
This is useful in *subtypep. For example, here is the way
generic-function initialization checks that the method-class is valid:
(and (classp method-class)
(*subtypep (class-eq-specializer method-class)
(find-class 'standard-method)))
If you want to define methods having class-eq specializers,
see "Initialization of method metaobjects". The default behavior of PCL
is to disallow this.
compute-applicable-methods-using-types
caching improvements
no magic-generic-functions list
This simplifies some things, but complicates some other things.
I wanted to support user-defined classes which are their own metaclass.
You can now do:
(defclass y (standard-class) ())
(defmethod validate-superclass ((c y) (sc standard-class)) t)
(defclass y (standard-class) () (:metaclass y))
method-function changes (see the comments for make-method-lambda, below)
final dfuns
-------------------------
gfs which obey AMOP ch 6
add-dependent
add-direct-method
add-direct-subclass
add-method
allocate-instance
compute-class-precedence-list
compute-default-initargs
compute-effective-slot-definition
[Note: compute-effective-slot-definition relys on
compute-effective-slot-definition-initargs and effective-slot-definition-class.
compute-effective-slot-definition-initargs is quite useful, but is not in
AMOP ch 6.]
compute-slots
direct-slot-definition-class
effective-slot-definition-class
ensure-class
ensure-class-using-class
ensure-generic-function
ensure-generic-function-using-class
eql-specializer-object
extract-lambda-list
extract-specializer-names
finalize-inheritance
find-method-combination
funcallable-standard-instance-access
{generic-function-method-class, generic-function-method-combination,
generic-function-lambda-list, generic-function-methods, generic-function-name}
intern-eql-specializer
make-instance
map-dependents
{method-function, method-generic-function, method-lambda-list,
method-specializers, method-qualifiers}
{class-default-initargs, class-direct-default-initargs, class-direct-slots,
class-direct-subclasses, class-direct-superclasses, class-finalized-p,
class-name, class-precedence-list, class-prototype, class-slots}
{slot-definition-allocation, slot-definition-initargs, slot-definition-initform,
slot-definition-initfunction, slot-definition-name, slot-definition-type}
{slot-definition-readers, slot-definition-writers}
{slot-definition-location}
remove-dependent
remove-direct-method
remove-direct-subclass
remove-method
set-funcallable-instance-function
(setf slot-value-using-class)
slot-boundp-using-class
slot-makunbound-using-class
specializer-direct-generic-functions
specializer-direct-methods
standard-instance-access
update-dependent
gfs which DO NOT obey AMOP ch 6
accessor-method-slot-definition
Not yet defined. Use accessor-method-slot-name and method-specializers
to get the direct-slot-definition.
compute-applicable-methods
compute-applicable-methods-using-classes
Handles class-eq specializers without signalling an error.
But see "Initialization of method metaobjects", below.
compute-discriminating-function
[the resulting function works differently different because
compute-effective-method is different, and because make-method-lambda
does not exist.]
compute-effective-method
Returns only one value. The utility of bringing this into conformance with
AMOP ch 6 is limited by the lack of make-method-lambda.
generic-function-argument-precedence-order
Not yet defined. Can get this information from the arg-info structure.
generic-function-declarations
Not yet defined.
make-method-lambda
Does not exist. This will be hard to add in a way that is compatible with
AMOP ch 6.
1. In March 92 PCL, there are two kinds of method-functions. The first kind
is what method-function returns (which has no special restrinctions on its use).
The second kind is returned by method-function-for-caching, which is used
when the wrappers of the required arguments are known. Each call to
method-function-for-caching might return a new function. Both kinds of
method functions can be closures. March 92 PCL currently uses this scheme
to do the pv-lookup ahead of time, thereby eliminating pv caching.
(pv-lookup means the lookup of the permutation vectors which are used for
fast instance varaible access.) Method function closures can also be used
in the optimization of calls to generic-functions, but this has not yet been
implemented.
2. Since method-functions can be closures, we would need an extra step between
compiling (or coercing) the method-lambda into a function, before it can be
applied to arguments with apply or funcall.
reader-method-class
Not yet defined. Some bootstrapping considerations are involved,
but adding this will not be very hard.
(setf class-name)
Currently just a writer method. Does not call reinitialize-instance or
(setf find-class).
(setf generic-function-name)
Currently just a writer method. Does not call reinitialize-instance.
writer-method-class
Not yet defined. Some bootstrapping considerations are involved,
but adding this will not be very hard.
---------------------------
Initialization of method metaobjects
The following methods are defined:
legal-qualifiers-p (method standard-method) qualifiers
legal-lambda-list-p (method standard-method) lambda-list
legal-specializers-p (method standard-method) specializers
legal-method-function-p (method standard-method) function
legal-documentation-p (method standard-method) documentation
legal-specializer-p (method standard-method) specializer
You can override them if you want.
The method for legal-specializers-p calls legal-specializer-p
on each specializer.
The method for legal-specializer-p allows any kind of specializer
when the vari